package com.bowos.zmado.web;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import com.orifine.web.ResourceInternationalization;

@Controller
public class I18nConstroller {
	@Autowired
	private ResourceInternationalization i18nManager;
	
	@RequestMapping(value = "/i18n/message", method = RequestMethod.GET)
	@ResponseBody
	public String getMessage(@RequestParam(value="key", required=true) String messageName, HttpServletRequest request){
		return i18nManager.getMessage(request.getLocale(), messageName);
	}
}
